package cn.itcast.activemq.sender;

import javax.jms.JMSException;
import javax.jms.MapMessage;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.springframework.stereotype.Service;

import com.aliyuncs.exceptions.ClientException;
import com.sun.mail.handlers.message_rfc822;

import cn.itcast.activemq.utils.SmsUtils;

@Service
public class SmsConsumer implements MessageListener {

	@Override
	public void onMessage(Message message) {
		// TODO Auto-generated method stub
		MapMessage mapMessage=(MapMessage)message;
		try {
			SmsUtils.sendCode(mapMessage.getString("telephone"), "code");
		} catch (ClientException | JMSException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
